package org.achartengine.internal.model;

import com.github.mikephil.charting.utils.Utils;
import java.util.ArrayList;
import java.util.List;

/* loaded from: classes2.dex */
public class j extends h {
    private List<Double> a;
    private double b;
    private double c;

    public j(String str) {
        super(str);
        this.a = new ArrayList();
        this.b = Double.MAX_VALUE;
        this.c = -1.7976931348623157E308d;
    }

    public synchronized void a(double d, double d2, double d3) {
        super.a(d, d2);
        this.a.add(Double.valueOf(d3));
        a(d3);
    }

    private void j() {
        this.b = Double.MAX_VALUE;
        this.c = Double.MAX_VALUE;
        int c = c();
        for (int i = 0; i < c; i++) {
            a(d(i));
        }
    }

    private void a(double d) {
        this.b = Math.min(this.b, d);
        this.c = Math.max(this.c, d);
    }

    @Override // org.achartengine.internal.model.h
    public synchronized void a(double d, double d2) {
        a(d, d2, Utils.DOUBLE_EPSILON);
    }

    @Override // org.achartengine.internal.model.h
    public synchronized void a(int i) {
        super.a(i);
        double doubleValue = this.a.remove(i).doubleValue();
        if (doubleValue == this.b || doubleValue == this.c) {
            j();
        }
    }

    @Override // org.achartengine.internal.model.h
    public synchronized void b() {
        super.b();
        this.a.clear();
        j();
    }

    public synchronized double d(int i) {
        return this.a.get(i).doubleValue();
    }

    public double h() {
        return this.b;
    }

    public double i() {
        return this.c;
    }
}
